var userGridCopyAddPageEventsData = {
    init: function (field) {
        var $ = layui.$;
        //  部门树
        layui.kaAjax.ajax(layui.kaBgUrl.url("getUserDeptTree"), function (rs) {
            if (rs.code == 200) {
                var xmSelectMapData = window.xmSelectMap.get("xmSelectdeptId");
                xmSelectMapData.update({
                    data: rs.data
                })
            }
        }, {});
        //  岗位
        layui.kaAjax.ajax(layui.kaBgUrl.url("getUserPosts"), function (rs) {
            if (rs.code == 200) {
                var xmSelectMapData = window.xmSelectMap.get("xmSelectpostIds");
                xmSelectMapData.update({
                    data: rs.data
                })
            }
        }, {});
        //  角色
        layui.kaAjax.ajax(layui.kaBgUrl.url("getUserRoles"), function (rs) {
            if (rs.code == 200) {
                var xmSelectMapData = window.xmSelectMap.get("xmSelectroleIds");
                xmSelectMapData.update({
                    data: rs.data
                })
            }
        }, {});
        var bodyUrl = layui.url().search;
        var data = [];
        layui.kaAjax.ajax(layui.kaBgUrl.url("getUserInfo"), function (rs) {
            if (rs.code == 200) {
              data = rs.data;
              var deptIds = [];
              deptIds.push(data.deptId);
              data.deptId = deptIds;
              data.postIds = rs.postIds;
              data.roleIds = rs.roleIds; 
              delete data.password;
              delete data.phonenumber;
              delete data.userName;
            }   
        }, {"userId": bodyUrl.userId});
        // 赋值
        layui.form.val('userGridCopyAdd', data);
        setTimeout(function (params) {
            layui.$(".kaXmSelectValue").each(function () {
                var id = $(this).attr("id");
                var name = $(this).attr("name");
                var xmSelectMapData = window.xmSelectMap.get(id);
                xmSelectMapData.setValue(data[name])
            });
        }, 50)
    }
}